package org.apache.ibatis.ztest.wrapper;

import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.wrapper.ObjectWrapper;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;

import java.util.Map;

/**
 * @author wangxinyuchuan
 * @version MyObjectFactoryWrapper.java v1.0 2023/12/22 16:18 wangxinyuchuan Exp $
 */
public class MyObjectWrapperFactory implements ObjectWrapperFactory {
  @Override
  public boolean hasWrapperFor(Object object) {
    return object instanceof Map;
  }

  @Override
  public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
    return new MyMapWrapper(metaObject, (Map<String, Object>) object);
  }
}
